﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using System.Drawing;
using System.Globalization;
using System.ComponentModel;

namespace PatientInformationExtract
{
    class ModifiedTickBar:TickBar
    {
        private List<string> displayTicks;
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            double num = this.Maximum - this.Minimum;
            FormattedText formattedText = null;
            double x = 0;
            displayTicks = new List<string>();
            displayTicks = ((CustomSlider)this.TemplatedParent).DisplayBottomTicks;
            if (displayTicks != null)
            {
                for (double i = 0; i <= num; i += this.TickFrequency)
                {
                    formattedText = new FormattedText(displayTicks[(int)i], CultureInfo.GetCultureInfo("en-us"), System.Windows.FlowDirection.LeftToRight, new Typeface("Verdana"), 12, System.Windows.Media.Brushes.Black);
                    formattedText.MaxTextWidth = 24;
                    formattedText.Trimming = System.Windows.TextTrimming.None;
                    formattedText.LineHeight = 10;
                    if (this.Minimum == i)
                    {
                        x = -5;
                    }
                    else
                    {
                        x += (this.ActualWidth-8) / num;
                    }
                    dc.DrawText(formattedText, new System.Windows.Point(x, 30));
                }
            }
        }
    }
}
